<!--
描述：考试-考试
开发人：桑杨
开发日期：2018年12月12日
-->
<template lang="pug">
  keep-alive
    kalix-table(bizKey="examing" title='考试列表'
    v-bind:targetURL="targetURL" v-bind:tableFields="tableFields" bizSearch="ExamingSearch"
    v-bind:btnList="btnList" v-bind:toolbarBtnList="toolbarBtnList"
    v-bind:customTableTool="customTableTool" ref="examingTable",
    v-on:afterDialogClose="dialogClose")
</template>

<script type="text/ecmascript-6">
  import {ExamingSelfURL} from '../config.toml'
  import {ExamingBtnList} from './config'

  export default {
    name: 'kalix-exam-examing',
    data() {
      return {
        btnList: ExamingBtnList,
        targetURL: ExamingSelfURL,
        toolbarBtnList: [
          {id: 'add', isShow: false}
        ],
        tableFields: [
          {prop: 'name', label: '考试名称'},
          {prop: 'subject', label: '考试科目'},
          {prop: 'duration', label: '考试时长（分钟）'}
        ]
      }
    },
    methods: {
      dialogClose() {
        this.$refs.examingTable.refresh()
      },
      customTableTool(row, btnId, _kalixTable) {
        switch (btnId) {
          case 'exam':
            this.requestFullScreen()
            _kalixTable.whichBizDialog = 'examingDialog'
            this.$nextTick(() => {
              _kalixTable.$refs.kalixDialog.open(row)
            })
            break
        }
      },
      requestFullScreen() {
        let element = document.getElementById('kalixApp')
        if (element.requestFullscreen) {
          element.requestFullscreen()
        } else if (element.mozRequestFullScreen) {
          element.mozRequestFullScreen()
        } else if (element.webkitRequestFullScreen) {
          element.webkitRequestFullScreen()
        } else if (element.msRequestFullscreen) {
          element.msRequestFullscreen()
        }
      }
    }
  }
</script>

<style scoped>

</style>

<style lang="stylus" rel="stylesheet/stylus">
  @import './exam-dialog.styl'
</style>
